$(function(){
    $('#shopping_cart').css('display','block');
    $('#header .nav_header>ul').css('width','773px');
    $('#header .nav_header>ul>li:first-child').removeClass('active');
    $('#header .nav_header>ul>li:first-child').attr('class','active');
    var value= window.localStorage.getItem('nubia_user_name');
    if(value){
        $('#header .users_centre').css('margin-left','32px');
    }
});
//商品菜单栏,子菜单弹出、隐藏
var showItems = function(e){
    e=e||window.event;
    var target = e.target;
    if(target.id!="product_list_menu"){
        while(!(target.nodeName=="LI"&&target.parentNode.getAttribute("id")=="product_list_menu")){
            target = target.parentNode;
        }
        $(target).children('div').css("display","block");
    }
    $(target).children('p').attr('class',"hover");
};
var hideItems = function(e){
    e=e||window.event;
    var target = e.target;
    if(target.id!="product_list_menu"){
        while(!(target.nodeName=="LI"&&target.parentNode.getAttribute("id")=="product_list_menu")){
            target = target.parentNode;
        }
        $(target).children('div').css("display","none");
    }
    $(target).children('p').removeAttr('class');
};
//鼠标移入移出图片放大缩小效果
var imgBlowUp = function(){
	$(this).children('div').children('img').css({'width':'270px','height':'270px','margin-left':'-10px','margin-top':'-10px'});
}
var imgBlowDown = function(){
	$(this).children('div').children('img').css({'width':'250px','height':'250px','margin-left':'0px','margin-top':'0px'});
}
//鼠标移入图片左移效果
var imgMoveLeft = function(){
	$(this).children('div').children('img').css('margin-left','-100px');
	$(this).children('ul').css('margin-left','-400px');
	$(this).children('dl').css('right','0px');
}
//鼠标移出图片移回效果
var imgMoveright = function(){
	$(this).children('div').children('img').css('margin-left','0px');
	$(this).children('ul').css('margin-left','0px');
	$(this).children('dl').css('right','-205px');
}
//商品菜单栏banner
var imgs1 = [
    {'i':0,'img':'imgs/market/146638696421.jpg'},{'i':1,'img':'imgs/market/146711282532.jpg'}
];
//新款商品banner
var imgs2 = [
    {'i':0,'img':'imgs/market/146712493665.jpg'},{'i':1,'img':'imgs/market/146712479717.jpg'}
];

$(function(){
    //商品菜单谈入 谈出
    $('#product_list_menu>li').mouseover(showItems);
    $('#product_list_menu>li').mouseout(hideItems);
    //商城首页鼠标移入移出效果
    $('.imgHoverBox').on('mouseover',imgBlowUp);
	$('.imgHoverBox').on('mouseout',imgBlowDown);
	$('[class^=emboitement_]').on('mouseover',imgBlowUp);
	$('[class^=emboitement_]').on('mouseout',imgBlowDown);
	$('.hot_products').on('mouseover',imgMoveLeft);
	$('.hot_products').on('mouseout',imgMoveright);
	$('.mountings_products>li').on('mouseover',imgMoveLeft);
	$('.mountings_products>li').on('mouseout',imgMoveright);
	$('.peripheral>li').on('mouseover',imgMoveLeft);
	$('.peripheral>li').on('mouseout',imgMoveright);
    //商品菜单栏banner
    slider(imgs1,$('.product_banner'),3000);
    slider(imgs2,$('.onsale_banner'),2000);
});





